{% extends 'base/base.html' %}

{% block title %}添加景点{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'css/culture.css' %}">
{% endblock %}

{% block sidebar %}
{# 同dashboard.html的sidebar #}
{% include 'culture/sidebar.html' %}
{% endblock %}

{% block content %}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
    <h1 class="h2">添加景点</h1>
</div>

<div class="card">
    <div class="card-body">
        <form method="post" enctype="multipart/form-data">
            {% csrf_token %}
            <div class="mb-3">
                <label for="id_name" class="form-label">景点名称</label>
                {{ form.name }}
                {% if form.name.errors %}
                <div class="invalid-feedback d-block">
                    {{ form.name.errors.as_text }}
                </div>
                {% endif %}
            </div>
            <div class="mb-3">
                <label for="id_description" class="form-label">景点描述</label>
                {{ form.description }}
                {% if form.description.errors %}
                <div class="invalid-feedback d-block">
                    {{ form.description.errors.as_text }}
                </div>
                {% endif %}
            </div>
            <div class="mb-3">
                <label for="id_location" class="form-label">景点位置</label>
                {{ form.location }}
                {% if form.location.errors %}
                <div class="invalid-feedback d-block">
                    {{ form.location.errors.as_text }}
                </div>
                {% endif %}
            </div>
            <div class="mb-3">
                <label for="id_cover_image" class="form-label">封面图片</label>
                {{ form.cover_image }}
                {% if form.cover_image.errors %}
                <div class="invalid-feedback d-block">
                    {{ form.cover_image.errors.as_text }}
                </div>
                {% endif %}
                <small class="text-muted">建议上传800x600像素的图片</small>
            </div>
            <button type="submit" class="btn btn-primary">提交审核</button>
            <a href="{% url 'accounts:spot_list' %}" class="btn btn-secondary">取消</a>
        </form>
    </div>
</div>
{% endblock %}

{% block extra_js %}
<script src="{% static 'js/culture.js' %}"></script>
{% endblock %}